//
//  OrderTableViewCell.m
//  ZiJinLian
//
//  Created by 🐛 on 2017/5/10.
//  Copyright © 2017年 lzy. All rights reserved.
//

#import "OrderTableViewCell.h"
#import "UIView+Extension.h"
@implementation OrderTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle=0;
    // Initialization code
}
-(void)creatOrderCellView{
    int count = 0;
    float btnWidth = 0;
    float viewHeight = 0;
    for (int i = 0; i < self.tagArray.count; i++) {
        
        NSString *btnName = self.tagArray[i][@"name"];
        
        _shopService = [[UILabel alloc]init];
        [_shopService setBackgroundColor:[UIColor whiteColor]];
        [_shopService setTextColor:Red_Color];
        _shopService.textAlignment=1;
        _shopService.text=btnName;
        _shopService.font = FontAndStyle12;
        //ViewRadius(_shopService, 1);
        //NSDictionary *dict = [NSDictionary dictionaryWithObject:FONT(12) forKey:NSFontAttributeName];
        CGSize btnSize = [_shopService.text sizeWithAttributes:@{NSFontAttributeName:_shopService.font }];
        
        _shopService.width = btnSize.width;
        _shopService.height = btnSize.height;
        
        if (i==0)
        {
            _shopService.x = 100;
            btnWidth = CGRectGetMaxX(_shopService.frame);
        }
        else{
            btnWidth += CGRectGetMaxX(_shopService.frame)+10;
            if (btnWidth > MainW) {
                count++;
                _shopService.x = 100;
                btnWidth = CGRectGetMaxX(_shopService.frame);
            }else{
                _shopService.x += btnWidth - _shopService.bsg_width;
            }
        }
        _shopService.y += count * (_shopService.bsg_height+10)+75;
        
        viewHeight = CGRectGetMaxY(_shopService.frame)+10;
        
        [self.contentView addSubview:_shopService];
        
        _shopService.tag = 10000+i;
        
    }
    self.bsg_height = viewHeight;
    if (viewHeight==0) {
        viewHeight=10;
    }

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
